<?php
/**
 * 后台新闻处理程序
 *
 * Created	  	: 2011-10-10
 * Modified   	: 2011-10-10
 * @link		: http://www.fqeat.com
 * @copyright	: (C) 2011
 * @version	: 0.1.0
 * @author		: Joseph Chen (jsph.chen@gmail.com)
 */
switch ($do) {
	
	case 'readGuestBook':
		$record = Guestbook::read($_GET['id']);
		echo json_encode($record);
		exit;
		break;
	case 'replyNoteGuestbook':
		if (empty($_POST['reply'])) {
			$reply = false;
		} else {
			$reply = $_POST['reply'];
		}
		if (empty($_POST['note'])) {
			$note = false;
		} else {
			$note = $_POST['note'];
		}
		$ret = Guestbook::replynote($_POST['id'], $reply, $note, $_POST['sendmail']);
		if (!empty($_GET['ajax'])) {
			if ($ret) {
				$response = array(
					'result'	=> true,
					'msg'		=> $GLOBALS['LSuccess'],
				);
			} else {
				$response = array(
					'result'	=> false,
					'msg'		=> App::msg(),
				);
			}
			echo json_encode($response);
			exit;
		}
		$r_url = 'admin.php?mo=guestBook';
		break;

	default:
		$type = 'Error';
		$desc = $GLOBALS['LUnknowRequest'];
		break;
		
}
$g_msg = array(
	'type' => isset($type) ? $type : 'Success',
	'desc' => isset($desc) ? $desc : $GLOBALS['LSuccess'],
);
if (empty($redirctMo)) {
	$redirctMo = 'guestBook';
}
empty($r_url) && $r_url = '?block=base&mo='.$redirctMo;
